/**
 * 游戏源文件
 */
ig.module(
	'game.main' 
)
.requires(
	'impact.game',
	'impact.font',
    'game.levels.dorm3'
)
.defines(function(){

MyGame = ig.Game.extend({
    background:new ig.Image("media/background.png"),
    gravity: 300,
	init: function() {

        this.loadLevel( LevelDorm3 );


	},
    /**
     * 计算物体位置
     */
	update: function() {
		// Update all entities and backgroundMaps

        // screen follows the player
        var player = this.getEntitiesByType( EntityPlayer )[0];
        if( player ) {
            this.screen.x = player.pos.x - ig.system.width/2;
            this.screen.y = player.pos.y - ig.system.height/2;
        }
        // Update all entities and BackgroundMaps
        this.parent();
		// Add your own, additional update code here
	},
    /**
     * 绘制物体
     */
	draw: function() {

        this.parent();

	}
});


// Start the Game with 60fps, a resolution of 320x240, scaled
// up by a factor of 2
//ig.main( '#canvas', MyGame, 60, 320, 480, 1);
//ig.main( '#canvas', MyGame, 60, 320, 240, 2 );
});
